﻿

using Maticsoft.BLL;
using Maticsoft.Model;

using System;
using System.Text;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using Wuqi.Webdiyer;

public partial class WebPage_User_guanliyuanbiao : SystemBBasePage
{

    private int ID;

    private string sql = "Manager='Y'";
    private int text = Convert.ToInt32(PageIndex.pageIndex);
    private Maticsoft.BLL.UserInfo user = new Maticsoft.BLL.UserInfo();

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        if (!base.IsPostBack)
        {
            if (base.Request.QueryString["id"] != null)
            {
                if (base.Request.QueryString["id"].ToString() != "")
                {
                    this.ID = Convert.ToInt32(base.Request.QueryString["id"].ToString());
                }
                else
                {
                    this.ID = 0;
                }
            }
            if ((base.Request.QueryString["action"] != null) && (base.Request.QueryString["id"] != null))
            {
                Maticsoft.BLL.UserInfo info = new Maticsoft.BLL.UserInfo();
            }
            this.pageSum(this.sql, this.text);
            this.PdbShow(this.text, 10, this.sql);
        }
        this.HeaderControl1.Select = "user";
    }

    protected void pager_PageChanging(object sender, PageChangingEventArgs e)
    {
        this.sql = string.Concat(new object[] { this.sql, " and  Id not in(select top ", (e.NewPageIndex - 1) * this.text, " Id from [User] where ", this.sql, "') " });
        this.PdbShow(this.text, 10, this.sql);
    }

    private void pageSum(string where, int count)
    {
        this.pager.AlwaysShow = true;
        this.pager.CurrentPageIndex = 1;
        this.pager.PageSize = count;
        this.pager.RecordCount = this.user.GetModelList(where).Count;
        this.pager.DataBind();
    }

    private void PdbShow(int sumPage, int index, string where)
    {
        StringBuilder builder = new StringBuilder();
        builder.Append("<tr >");
        builder.Append("<th width='50'>ID</th>");
        builder.Append("<th width='200'>Email</th>");
        builder.Append("<th width='100' nowrap>用户名</th>");
        builder.Append("<th nowrap style='width: 111px'>姓名</th>");
        builder.Append("<th width='200'>注册时间</th>");
        builder.Append("<th width='100'>手机号码</th>");
        builder.Append("<th width='80'>操作</th>");
        builder.Append("</tr>");
        this.Literal1.Text = builder.ToString();
        StringBuilder builder2 = new StringBuilder();
        Maticsoft.BLL.UserInfo info = new Maticsoft.BLL.UserInfo();
        int num = 0;
        foreach (Maticsoft.Model.UserInfo info2 in info.GetList(sumPage, index, where))
        {
            if ((num % 2) != 0)
            {
                builder2.Append("<tr>");
            }
            else
            {
                builder2.Append("<tr class='alt'>");
            }
            num++;
            builder2.Append("<td>" + info2.Id + "</td>");
            builder2.Append("<td>" + info2.Email + "</td>");
            builder2.Append("<td>" + info2.Username + "</td>");
            builder2.Append("<td style='width: 111px'>" + info2.Realname + "</td>");
            builder2.Append("<td>" + info2.Create_time + "</td>");
            builder2.Append("<td>" + info2.Mobile + "</td>");
            builder2.Append("<td class='op' nowrap>");
            builder2.Append("<a href='User_Bianji.aspx?id=" + info2.Id + "'>编辑</a>｜");
            builder2.Append("<a class='ajaxlink' href='/ajax/manage.aspx?action=authorization&id=" + info2.Id + "'>授权</a>");
            builder2.Append("</td>");
            builder2.Append("</tr>");
        }
        this.Literal2.Text = builder2.ToString();
    }
}

